package com.itheima.lambda;

public class Test {
    public static void main(String[] args) {
            useSwim(new Swim() {
                @Override
                public void Swimming() {
                    System.out.println("我是匿名内部类的show方法");
                }
            });


            //lambda实现
        useSwim(()->{System.out.println("我是匿名内部类的show方法");});


    }

public static void useSwim(Swim Swim){
        Swim.Swimming();
}
    //2.定义方法
    //形参是接口类型时，未来实参要给该接口的实现类对象
}

//1.定义接口
interface Swim{
    //有且仅有一个抽象方法的接口我们称之为函数式接口
    void Swimming();

}